package com.service.yzj.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.service.yzj.dao.DAddressMapper;
import com.service.yzj.model.DAddress;

import java.util.List;
import java.util.Optional;
// import java.util.ArrayList;

@Service
public class DAddressServiceImpl implements DAddressService {

  final DAddressMapper dAddressMapper;

  public DAddressServiceImpl(@Autowired DAddressMapper dAddressMapper) {
    this.dAddressMapper = dAddressMapper;
  }

  @Override
  public List<DAddress> getAllAddresses() {
    return dAddressMapper.getAllAddresses();
  }

  @Override
  public Optional<DAddress> getAddressById(Integer id) {
    return Optional.ofNullable(dAddressMapper.getAddressById(id));
  }
}
